<template>
  <div class="cart-list" v-if="cartList.length !== 0">
    <scroll class="cart-content" ref="scroll">
      <cart-list-item v-for="(item, i) in cartList" :key="i" :product="item"/>
    </scroll>
  </div>
</template>

<script>
  import CartListItem from './CartListItem.vue'

  import Scroll from 'components/common/scroll/Scroll'

  import {mapGetters} from 'vuex'

  export default {
    name: 'CartList',
    components: {
      CartListItem,

      Scroll
    },
    computed: {
      ...mapGetters(['cartList'])
    },
    activated() {
      this.$refs.scroll && this.$refs.scroll.refresh()
    }
  }
</script>

<style scoped>
  .cart-list {
    height: calc(100% - 44px - 49px - 40px);
  } 

  .cart-content {
    overflow: hidden;
    /* position: absolute;
    top: 44px;
    bottom: 49px;
    left: 0;
    right: 0; */
    height: 100%;
  }
</style>